package com.bosssoft.hr.javase;

import java.util.Arrays;
import java.util.Set;
import java.util.TreeSet;

/**
 * @Description: TreeSetExample
 * @Author: WengYu
 * @CreateTime: 2022/05/12 15:40
 */
public class TreeSetExample {
    private Set<User> set = new TreeSet<>();


    User[] sort(User[] users){
        Arrays.sort(users);
        return users;
    }

    public boolean add(User user){
        return set.add(user);
    }

    public boolean remove(User user){
        return set.remove(user);
    }

    public boolean contains(User user){
        return set.contains(user);
    }

    public User[] toArray(){
        return set.toArray(new User[set.size()]);
    }

}
